<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        body {
            perspective: 400px;
        }
        .box {
            width: 100px;
            height: 100px;
            text-align: center;
            line-height: 100px;
            transform-style: preserve-3d;
            transition: all 1s;
            margin: 100px auto;
        }
        .front, .bottom {
            width: 100px;
            height: 100px;
        }
        .front {
            background-color: orange;
        }
        .bottom {
            background-color: skyblue;
            /* 设置旋转轴为上边沿 */
            transform-origin: top center;
            transform: rotateX(-90deg);
        }
        .box:hover {
            /* transform-origin: bottom center; */
            transform: rotateX(90deg);
        }
    </style>
</head>
<body>
    <div class="box">
        <div class="front">这是正面</div>
        <div class="bottom">这是底面</div>
    </div>
</body>
</html>